package ddd.valueobject;

import lombok.Data;

@Data
public class Gender {
    private final Integer gender;

    public Gender(Integer gender){
       if (gender == null) throw new RuntimeException("param is null");
       this.gender = gender;
    }

    public String transferToStr(Integer gender){
        String gend = null;
        switch (gender){
            case 1:
                gend = "男";
                break;
            case 2:
                gend = "女";
                break;
            default:
                gend = "未知";
                break;
        }
        return gend;
    }

    public Integer transferToInt(String gender){
        Integer gend = null;
        switch (gender){
            case "男":
                gend = 1;
                break;
            case "女":
                gend = 2;
                break;
            default:
                gend = 3;
                break;
        }
        return gend;
    }
}
